<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <link rel="stylesheet" href="/static/home/css/style.css">
    <link rel="stylesheet" href="/static/public/layui/css/layui.css">

    <script type="text/javascript" src="/static/public/layui/layui.js"></script>
</head>
<body>
<form class="layui-form">
    @csrf
    <input type="hidden" name="id" value="{{ $member->id }}">
    <div class="layui-form-item">
        <label class="layui-form-label">手机号</label>
        <div class="layui-input-inline">
            <input type="text"  placeholder="请输入账号" class="layui-input" value="{{ $member->phone }}" disabled>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">账号</label>
        <div class="layui-input-inline">
            <input type="text" name="user_name" placeholder="请输入账号" class="layui-input" value="{{ $item['user_name'] }}" {{ $item['user_name'] ==""?'':'disabled' }}>
        </div>
    </div>
    <div class="layui-form-item">

        <label class="layui-form-label">昵称</label>
        <div class="layui-input-inline">
            <input type="text" name="nick_name" placeholder="请输入昵称" class="layui-input" value="{{ $item['nick_name'] }}" >
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">邮箱</label>
        <div class="layui-input-inline">
            <input type="email" name="email" placeholder="请输入邮箱" class="layui-input" value="{{ $item['email'] }}" {{ $item['email'] ==""?'':'disabled' }}>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button type="button" class="layui-btn" onclick="save()">保存</button>
        </div>
    </div>

</form>
<script type="text/javascript">
    layui.use(['layer','form'],function () {
        layer = layui.layer;
        form  = layui.form;
        $ = layui.jquery;
    })
    function save() {
        var _token = $.trim($('input[name="_token"]').val());
        var id = $.trim($('input[name="id"]').val());
        var user_name = $.trim($('input[name="user_name"]').val());
        var nick_name = $.trim($('input[name="nick_name"]').val());
        var email = $.trim($('input[name="email"]').val());

        $.post('/per/ge_save', {_token:_token,id:id,user_name:user_name,nick_name:nick_name,email:email},function(res){
            if(res.code>0){
                return layer.alert(res.msg,{icon:2});
            }
            layer.msg(res.msg);
        },'json');
    }
</script>
</body>
</html>
